package com.why.oss.uitls;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @program: guli_parent
 * @description:
 * @author: @why
 * @create: 2021-01-30 11:44
 **/
@Component
public  class ConstantPropertiesUtils implements InitializingBean {
    @Value("${aliyun.oss.file.keyid}")
    private String ossId;
    @Value("${aliyun.oss.file.keysecret}")
    private String oosPassword;
    @Value("${aliyun.oss.file.endpoint}")
    private String ossUrL;
    @Value(("${aliyun.oss.file.bucketname}"))
    private String ossBucketName;

    public static String END_POINT;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String BUCKET_NAME;

    /**
     * spring将上面的值赋值完成后执行这个方法
     * @throws Exception
     */

    @Override
    public void afterPropertiesSet() throws Exception {
    END_POINT=this.ossUrL;
    ACCESS_KEY_ID=this.ossId;
    ACCESS_KEY_SECRET=this.oosPassword;
    BUCKET_NAME=this.ossBucketName;
    }
}
